<?php

class RelatoriosController extends BaseController {
	
	public function indexAction() {
		
		echo $this->view->menu = 'Menu';
	}
	
	public function planodecontasAction(){
	
		
		
		$filtros = new Form_FiltrarPlanodeContas_Filtrar();
		$this->view->formfiltro = $filtros;
		if ($this->getRequest()->isPost() && $this->_getParam('filtrar')){
		$model = new Application_Model_View_Planodecontas();	
		$servidor = strtoupper($this->_getParam('servidor'));
		$orgao = strtoupper($this->_getParam('orgao'));
		$campos = $model->fetchAll("servidor like '%$servidor%' and nome_orgao like '%$orgao%'");
		$this->view->campos = $campos;	
		} 
		else {
		$model = new Application_Model_View_Planodecontas();
		$campos = $model->fetchAll();
			
		$this->view->campos = $campos;	
		}
         
	}
	
}


